<style>
	#wifiStatusA{
		color:#fff;
		border-radius:5px;
		width:150px;
		margin-left:50px;
		text-align:center;
	}
	#wifiStatusB{
	color:#fff;
		border-radius:5px;
		width:150px;
		margin-left:50px;
		text-align:center;
	}
</style>
<div class="card">
    <div class="card-block">
        <div class="table-responsive">
            <div id="data-table_wrapper" class="dataTables_wrapper">
                <div id="data-table_filter" class="dataTables_filter">
                    <form class="hotel-info-form" id="hotelinfo" enctype="multipart/form-data">
                        <div class="row">
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	酒店
					            	</span>
                                    <div class="form-group">
                                    	<input type="text" name="hotelId" id="hotelId" hidden>
                                    	<input type="text" name="mobile" id="mobile" hidden>
                                        <input type="text" name="hotelName" id="hotelName" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	酒店编号
					            	</span>
                                    <div class="form-group">
                                        <input type="text" name="hotelSn" id="hotelSn" class="form-control">
                                    </div>
                                </div>
                            </div>
                            <<!-- div class="col-sm-3">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	小程序ID
					            	</span>
                                    <div class="form-group">
                                        <input type="text" name="appid" id="appid" class="form-control">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                            </div> -->
                        </div>
                        <div class="row">
	                        <div class="input-group">
	                             <span class="input-group-addon">
					             	酒店信息
					          	 </span>
                            </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-9">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	酒店介绍
					            	</span>
                                    <div class="form-group">
                                         <textarea name="summary" id="summary" class="form-control"></textarea>
                             			 <i class="form-group__bar"></i>
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-9">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	酒店Banner
					            	</span>
					            	<span class="input-group-addon">
					            		<div style="border:0;width:100px;height:30px;position: relative; margin-right:30px;line-height:30px;text-align:center;position: relative;border-radius:5px;background:#32c787;color:#fff;">
					            			上传图片
					           				<input type="file" id="hotelBanner" style="border:0;width:100px;height:30px;position: absolute;left:0;top:0;opacity:0;filter:alpha(opacity=0);" accept=".JPG,.PNG" name="files" multiple onchange="checkPicForm()"/>
					            		</div>
					            	</span>
					            	<div id="oldPicUrl"></div>
					            	<div id="newPicUrl"></div>
                                </div>
                             </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	酒店地址
					            	</span>
                                    <div class="form-group">
                                         <input type="text" name="address" id="address" class="form-control">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row">
                        	<div class="col-sm-6">
                        		<!--酒店地图-->
                        		<div id="l-map" style='height:300px;width:100%;'></div>
                        		<!--经度-->
                        		<input type="hidden" id='lat' name='latitude' />
                        		<!--纬度-->
                        		<input type="hidden" id='lng' name='longitude' />
                        	</div>
                        </div>
                         <!-- <div class="row">
	                        <div class="col-sm-6">
                                 <div class="input-group">
                                    <span class="input-group-addon">
					               	酒店标签
					            	</span>
                                    <div class="form-group">
                                        <input type="text" name="tag" id="tag" class="form-control">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                             </div>                            
                        </div> -->
                        <div class="row">
	                        <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	联系方式
					            	</span>
                                    <div class="form-group">
                                        <input type="text" name="phone" id="phone" class="form-control">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-1">
                                 <div class="input-group">
                                    <span class="input-group-addon" style='padding: 8.5px 13px!important;'>
					              	 地标建筑
					            	</span>
                                </div>
                             </div>
                             <div class="col-sm-2">
                                <div class="input-group">
                                	<span class="input-group-addon">
					              	距离
					            	</span>
                                    <div class="form-group">
                                        <input type="text" name="markOne" id="markOne" class="form-control"/>
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-1">
                                <div class="input-group">
                                    <div class="form-group">
                                        <input type="number" name="markTwo" id="markTwo" style="width:55px" class="form-control"/>
                                        <i class="form-group__bar"></i>
                                    </div><span class="input-group-addon">m</span>
                                </div>
                            </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-9">
                                <div class="input-group">
                                    <span class="input-group-addon"  style='padding: 8.5px 13px!important;'>
					              	酒店设施
					            	</span>
                                    <div class="form-group facilities" style="margin-top:0.5rem;">
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row">
                           <div class="col-sm-9">
                               <div class="input-group">
                                    <span class="input-group-addon"  style='padding: 8.5px 13px!important;'>
					              	 酒店政策
					            	</span>
                                    <div class="form-group policies" style="margin-top:0.5rem;">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                           <div class="col-sm-11">
                               <div class="input-group">
                                    <span class="input-group-addon">
					              	相关房策填写
					            	</span>
                                    <div class="form-group">
                                         <textarea name="myPolicies" id="myPolicies" class="form-control"></textarea>
                             			 <i class="form-group__bar"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
	                        <div class="input-group">
	                             <span class="input-group-addon">
					             	小程序Wi-Fi设置
					          	 </span>
                            </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	Wi-Fi模块是否启用
					            	</span>
                                    <div class="form-group">
                                    	<div class="switch switch-large">
										   <a class="form-control btn-save"  id="wifiStatusA" onclick="onSwitch()">开启（请点击开启）<input  id="wifiStatus" name="wifiStatus" type="hidden" value="0"/></a>
										</div>
                                         <!-- <input name="wifiStatus" id="wifiStatus" class="form-control" />
                             			 <i class="form-group__bar"></i> -->
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row wifi_div" style="display: none;">
	                        <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	SSID
					            	</span>
                                    <div class="form-group">
                                         <textarea name="wifiName" id="wifiName" class="form-control"></textarea>
                             			 <i class="form-group__bar"></i>
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row wifi_div" style="display: none;">
	                        <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	BSSID
					            	</span>
                                    <div class="form-group">
                                        <input type="text" name="wifiPassword" id="wifiPassword" class="form-control"/>
                             			 <i class="form-group__bar"></i>
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row">
	                        <div class="input-group">
	                             <span class="input-group-addon">
					             	小程序发票开具设置
					          	 </span>
                            </div>
                        </div>
                        <div class="row">
	                        <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">
					               	发票开具是否启用
					            	</span>
                                    <div class="form-group">
                                    	<div class="switch switch-large">
										   <a class="form-control btn-save"    id="wifiStatusB" onclick="onSwitchByinvoice()">开启（请点击开启）<input  id="invoiceStatus" name="inoivceStatus" type="hidden" value="0"/></a>
										</div>
                                    </div>
                                </div>
                             </div>
                        </div>
                        <div class="row invoice_div" style="display: none;">
	                        <div class="col-sm-3">
	                       		 <input class='check' id='int' style='opacity:1!important;z-index:1!important;' name='invoiceType' type='checkbox' value='1' > 
	                       		 
	                       		 <span style="font-size: 13px!important">纸质增值税普通发票</span>
                             </div>
	                        <div class="col-sm-3">
	                       		 <input class='check' id='int1' style='opacity:1!important;z-index:1!important;' name='invoiceType' type='checkbox' value='2' > 
	                       		 
	                       		 <span style="font-size:13px!important">纸质增值税专用发票</span>
                             </div>
	                        <div class="col-sm-3">
	                       		  <input class='check' id='int2' style='opacity:1!important;z-index:1!important;' name='invoiceType' type='checkbox' value='3' >
	                       		 
	                       		 <span style="font-size:13px!important">电子普通发票</span>
                             </div>
                        </div>
                    </form>
                </div>
            </div> 
            <div class="modal-footer">
            	<div class="btn btn-save" id="hotel-save-button"  onclick='updateHotel()'>保存</div>
         	</div>   
        </div>
    </div>
</div>
<style>
.tangram-suggestion{
display:none;
}

</style>
<!-- <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Z2DoHAztIawoVmM9pygVV0Hf"></script> -->
<script data-th-src="@{js/app/hotel/hotel/jquery.form.js}"></script>
<script data-th-src="@{js/app/hotel/hotel/hotelEdit.js}"></script>
<script type="text/javascript">
	$(function(){
			
			$("#address").focus(function(){
				$(".tangram-suggestion").show()
			});
			// 百度地图API功能
			function G(id) {
				return document.getElementById(id);
			}
		
			var map = new BMap.Map("l-map");
			map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
		    map.addControl(new BMap.OverviewMapControl()); //添加默认缩略地图控件
		    
		    $.post(ctx + "hotel/getHotel", function (r) {
				var hotel=r.hotel;
				if(hotel!=null){
					
					// 百度地图API功能
					var point = new BMap.Point(hotel.longitude, hotel.latitude);
					map.centerAndZoom(point, 15);
					
					//创建坐标点
					var pt = new BMap.Point(hotel.longitude, hotel.latitude);
					var marker2 = new BMap.Marker(pt);  // 创建标注
					map.addOverlay(marker2);   
				}else{
					map.centerAndZoom("北京",12);                   // 初始化地图,设置城市和地图级别。
				}
			})
			
		    
			var ac = new BMap.Autocomplete(    //建立一个自动完成的对象
				{"input" : "address"
				,"location" : map
			});
		
			ac.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
			var str = "";
				var _value = e.fromitem.value;
				var value = "";
				if (e.fromitem.index > -1) {
					value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
				}    
				
				
				value = "";
				if (e.toitem.index > -1) {
					_value = e.toitem.value;
					value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
				}    
				
				
			});
		
			var myValue;
			ac.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件
			var _value = e.item.value;
				myValue = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
				setPlace();
				
			});
			//鼠标点击地图选取
			map.addEventListener("click",function(e){
				var marker = new BMap.Marker(e.point); 
				console.log()
				G("lat").value = e.point.lat; 
				G("lng").value = e.point.lng;
		        map.clearOverlays();  
		        map.addOverlay(marker)
			}); 
		
			function setPlace(){
				map.clearOverlays();    //清除地图上所有覆盖物
				function myFun(){
					var pp = local.getResults().getPoi(0).point;    //获取第一个智能搜索的结果
					
					G("lat").value = pp.lat; 
					G("lng").value = pp.lng; 
					map.centerAndZoom(pp, 18);
					map.addOverlay(new BMap.Marker(pp));    //添加标注
				}
				var local = new BMap.LocalSearch(map, { //智能搜索
				  onSearchComplete: myFun
				});
				local.search(myValue);
			}	
	
	})
</script>